home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.3 / Video Toaster v4.3.iso / 3.1 / toasterall / arexx_examples / tpaint / embosspic.rexx < prev    next >
OS/2 REXX Batch file  |  1992-09-09  |  4KB  |  106 lines

  1. /* EmbossPic.rexx  Make embossed look image from ToasterPaint screen */
  2. /* By Arnie Cachelin © 1992 NewTek Inc */
  3. /* 02 Jan 1992 At 10:52:01 */
  4.  
  5. /*
  6.  This program will make an 'embossed' version of whatever image is currently
  7.  in ToasterPaint. It works by blending the picture with a negative version of
  8.  itself, with a small offset.  If picture filenames are given, pictures will be
  9.  loaded and even saved.  This process uses a brush the size of the whole screen,
  10.  and this uses a bunch of memory. To help conserve memory, the program deletes
  11.  the swap screen with the 'Dswa' command.
  12. */
  13.  
  14. ARG iffname outname
  15.  
  16. centerx=376
  17. centery=240
  18. offset=3
  19.  
  20. Address "DigiPaint"     /* Tell ARexx where commands go  */
  21.  
  22. if iffname~="" Then Call LoadRGB(iffname)
  23. call BWscreen()  /* This works better with a black and white image */
  24. 'Blu2'    /* Heavy Blur (Optional) takes a while huh */
  25. 'Whsc'    /* Do to whole screen */
  26. 'Blu2'    /* Heavy Blur (Optional) takes a while huh */
  27. 'Whsc'    /* Do to whole screen */
  28. 'Blu2'    /* Heavy Blur (Optional) */
  29. 'Whsc'    /* Do to whole screen */
  30. 'Bdel'    /* Delete Swap brush */
  31. 'Dswa'    /* Delete Swap screen (not needed, helps with low memory */
  32. 'Dotb'    /* 1 pixel Brush */
  33. 'Scis'    /* Brush cutter */
  34. 'Drre'    /* Draw rectangles */
  35. 'Whsc'    /* Do to whole screen */
  36. 'Bcop'    /* Copy current brush to Swap brush */
  37. call negativescreen()   /* Make the screen negative */
  38. 'Hvof'    /* Blend gradient off (center=edge) */
  39. 'Midc'    /* Set center blend to mid way (50% transparency) */
  40. 'Pmcl'    /* Normal paint mode */
  41. 'Bres'    /* restore brush from swap brush */
  42. 'Pend'    centerx+offset centery+offset /* Plant brush with slight offset */
  43. 'Penu'    centerx+offset centery+offset
  44. 'Shco'    /* render to composite out */
  45. if outname~="" Then SaveRGB(outname)    /* Optional file save */
  46. 'Maxc'    /* Set center blend back to 100% opacity) */
  47. 'Bdel'    /* Delete Swap brush .. it's polite to clean up after oneself */
  48.  
  49. exit
  50.  
  51. NegativeScreen: Procedure   /* Make screen its negative */
  52.   'Hvof'        /* Blend gradient off (center=edge) */
  53.   'Maxc'        /* Set center blend to mid way */
  54.   'Drre'        /* Draw rectangles */
  55.   'Flon'        /* Fill On */
  56.   '8rgb' 255 255 255  /* White color */
  57.   'Pmxo'        /* XOR mode */
  58.   'Whsc'        /* Do to whole screen */
  59.   'Flof'        /* Fill Off */
  60.   return 0
  61.  
  62. BWScreen: Procedure   /* Make screen Black and White */
  63.   'Hvof'        /* Blend gradient off (center=edge) */
  64.   'Maxc'        /* Set center blend to mid way */
  65.   'Drre'        /* Draw rectangles */
  66.   'Flon'        /* Fill On */
  67.   '8rgb' 255 255 255  /* White color */
  68.   'Pmco'        /* Colorize mode */
  69.   'Whsc'        /* Do to whole screen */
  70.   'Flof'        /* Fill Off */
  71.   return 0
  72.  
  73. SetFile: PROCEDURE           /* Select file in current requester */
  74.   arg file
  75.   dirname=GetPathName(file)
  76.   'Dnam'dirname          /* Enter file path  */
  77.   'Dsel'                 /* Hit return on directory */
  78.   filename=GetFileName(file)
  79.   'Fnam'filename         /* Enter File name  */
  80.   'Okls'                 /* Hit the OK button  */
  81.   return
  82.  
  83. SaveRGB: PROCEDURE   /* Load Brush, copy into swap buffer */
  84.   arg filename
  85.   'Sa24'                 /* Call file requester  */
  86.     Call SetFile(filename)
  87.   return
  88.  
  89. LoadRGB: PROCEDURE   /* Load Brush */
  90.   arg filename
  91.   'Lo24'                 /* Call file requester  */
  92.     Call SetFile(filename)
  93.   return
  94.  
  95. GetFileName: procedure  /* Extract file name from full file specification */
  96.   ARG fullfile
  97.   c = lastpos("/",fullfile)
  98.   if c = 0 then c = lastpos(":",fullfile)
  99.   return substr(fullfile, c + 1)
  100.  
  101. GetPathName: procedure  /* Extract directory name from full file specification */
  102.   ARG fullfile
  103.   c = lastpos("/",fullfile)
  104.   if c = 0 then c = lastpos(":",fullfile)
  105.   return left(fullfile,c)
  106.